import React, { FC } from "react";
import QuestionCard from "../../../components/QuestionCard";
import ListSearch from "../../../components/ListSearch";
import style from "../common.module.scss";
import useLoadQuestionListData from "../../../hooks/useLoadQuestionListData";
import ListPage from "../../../components/ListPage";
import { Typography, Empty, Spin } from "antd";
const { Title } = Typography;

// const  rowQuestionList = [
//     {_id:1,title:'问卷1',isPublished:false,isStar:true,answerCount:2,createAt:'2025-01-19'},
//     {_id:2,title:'问卷2',isPublished:false ,isStar:true,answerCount:2,createAt:'2025-01-19'},
//     {_id:3,title:'问卷3',isPublished:true ,isStar:true,answerCount:3,createAt:'2025-01-19'},

// ]
const Star: FC = () => {
  // const [questionList,setQuestionList] = useState(rowQuestionList)

  const {
    data = {},
    error,
    loading,
  } = useLoadQuestionListData({ isStar: true });
  const { list = [], total = 0 } = data;
  return (
    <>
      <div className={style.header}>
        <div className={style.left}>
          {/* <h3>我的问卷</h3> */}
          <Title level={3}>标星问卷</Title>
        </div>
        <div className={style.right}>
          <ListSearch />{" "}
        </div>
      </div>
      <div className={style.content}>
        {loading && (
          <div style={{ textAlign: "center" }}>
            <Spin></Spin>
          </div>
        )}
        {!loading && list.length === 0 && <Empty description="暂无数据   " />}
        {list.length > 0 &&
          list.map((item: any) => {
            const { _id: _id } = item;
            return <QuestionCard key={_id} {...item} />;
          })}
      </div>

      <div className={style.footer}>
        <ListPage total={total}></ListPage>
      </div>
    </>
  );
};
export default Star;
